import React, {PropsWithChildren, useMemo} from "react"
import {observer} from "mobx-react-lite";
import employeeAuthorizationStore from "../store/EmployeeAuthorizationStore";
import {Authority, authorityTree} from "../apis/RoleApi";

type AuthorizationResourceProps = PropsWithChildren<{
    authorities: Authority[]
}>;
const AuthorizationResource: React.FC<AuthorizationResourceProps> = ({authorities, children}) => {
    return (
        <>
            {employeeAuthorizationStore.hasAllAuthority(...authorities) ? children : undefined}
        </>
    )
}

export default observer(AuthorizationResource)
